package com.chenfan.mcn.model.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.chenfan.mcn.utils.CommonUtil;
import lombok.Data;

import java.util.Map;

/**
 * 直播商品-批量导入失败原因DTO
 * @author wulg
 * @date 2023/3/15
 */
@Data
public class LiveCommodityOutputDTO extends LiveCommodityInputDTO {

    private static final long serialVersionUID = -4591017953737695229L;

    /**
     * 失败原因
     */
    @Excel(name = "失败原因" , orderNum = "100")
    private String failedReason;

    /**
     * 校验系统数据匹配
     * @param anchorMap
     * @param livePlatformNameMap
     * @param separator
     */
    public void verifySysDataMatch(Map<String, Long> anchorMap,  Map<String, String> livePlatformNameMap, String separator) {
        if(!anchorMap.containsKey(this.getAnchorName())) {
            this.setFailedReason(CommonUtil.joinWith(separator,this.getFailedReason(), "【主播】录入错误，请检查后重试！"));
        }
        if(!livePlatformNameMap.containsKey(this.getLivePlatformName())) {
            this.setFailedReason(CommonUtil.joinWith(separator,this.getFailedReason(), "【直播平台】录入错误，请检查后重试！"));
        }
    }
}
